<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich" >
    <h:head>
        <script type="text/javascript">
            function showDept()
            {
                window.open("./contract/pubinfo/departments.jsf","部门信息","height=480,width=750,toolbar=no,menubar=no,scrollbars=no");
            }
            function updateDept(dcode,dname)
            {
                form=document.forms['emp'];
                document.getElementById('emp:deptcode').value = dcode;
                document.getElementById('emp:deptname').value = dname; 
            }
        </script>
        <style type="text/css">
            .pic{
                margin-bottom: -4px;
                margin-right: 2px;
                border:none;
            }
        </style>
    </h:head>
        <h:form id="emp">
            <rich:panel header="合同类别">
                <rich:toolbar  itemSeparator="grid">
                    <rich:toolbarGroup>
                        <h:commandButton value="新建" action="#{contracttype.add}"/>
                        <h:commandButton value="修改" action="#{contracttype.update}" disabled="#{contracttype.addOrUpdate || contracttype.contracttype.code eq ''}"/>
                        <h:commandButton value="删除" action="#{contracttype.delete}" disabled="#{!contracttype.showAble}"/>
                        <h:commandButton value="保存" action="#{contracttype.save}" disabled="#{!contracttype.showAble}"/>
                        <h:commandButton value="取消" action="#{contracttype.cancel}" disabled="#{!contracttype.showAble}"/>
                    </rich:toolbarGroup>
                </rich:toolbar>

                <h:panelGroup  id="edit">
                    <h:panelGrid width="60%" columns="2" border="0">
                        <h:outputLabel value="代码：" for="code"/>
                        <h:inputText readonly="#{!contracttype.addOrUpdate}" id="code" value="#{contracttype.contracttype.code}"/> 

                        <h:outputLabel value="名称：" for="name"/>
                        <h:inputText  readonly="#{!contracttype.showAble}" id="name"  value="#{contracttype.contracttype.name}"/>
                    </h:panelGrid>
                     </h:panelGroup>
                    <hr/>
                    <rich:dataTable id="editTable" value="#{contracttype.typeModel}" var="emp"
                                    onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                    onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                    rowClasses="list-row-odd,list-row-even" >
                        <h:column>
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="代码"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:commandLink action="#{contracttype.show}">
                                <h:outputText value="#{emp.code}"/>
                            </h:commandLink>
                        </h:column>

                        <h:column>
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="名称"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{emp.name}"/>
                        </h:column>

                    </rich:dataTable>
               
            </rich:panel>
        </h:form>
 
</ui:composition>
